package com.yonyou.cyxdms.sysAuth.service.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.yonyou.cyxdms.framework.bean.entity.base.DMSBasePO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;

import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;
import com.yonyou.cyx.framework.bean.dto.base.BaseDTO;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 菜单数据权限
 *
 * @author quankk
 * @since 2019-07-05
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("tc_menu_range")
public class MenuRangePO extends DMSBasePO<MenuRangePO> {

    private static final long serialVersionUID = 1L;

    /**
     * MENU_RANGE_ID
     */
    @TableId(value = "MENU_RANGE_ID", type = IdType.AUTO)
    private Integer menuRangeId;

    /**
     * MENU_ID
     */
    @TableField("MENU_ID")
    private Long menuId;

    /**
     * 本人、本组织、本组织及下属、所有
     */
    @TableField("RANGE_CODE")
    private Integer rangeCode;

    @TableField("IS_DEFAULT")
    private Integer isDefault;

    @Override
    protected Serializable pkVal() {
        return this.menuRangeId;
    }

    /**
     * 将PO 信息转化为DTO
     *
     * @param dto 需要进行转换的dto
     * @author quankk
     * @since 2018/7/22 0022
     */
    protected <T extends BaseDTO> void transDtoToPo(T dto) {
        BeanMapperUtil.copyProperties(this, dto, "menuRangeId");
    }

}
